package com.thoughtworks.collection;

import sun.reflect.generics.reflectiveObjects.NotImplementedException;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class MyMap {

    List<Integer> array;
    private String[] letters = new String[]{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
            "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
    private List<String> letterList = Arrays.asList(letters);

    public MyMap(List<Integer> array) {
        this.array = array;
    }

    public List<Integer> getTriple() {
        List<Integer> list = new ArrayList<>();
        for (Integer integer : array) {
            list.add( integer *3);
        }
        return list;
    }

    public List<String> mapLetter() {
        List<String> list = new ArrayList<>();
        for (Integer integer : array) {
            list.add(letters[integer-1]);
        }
        return list;
    }

    public List<String> mapLetters() {
        List<String> list = new ArrayList<>();
        for (Integer integer : array) {
            if (integer>=1 && integer<=26){
                list.add(letters[integer-1]);
            }
            if (integer>26&& integer<=52){
                list.add(letters[0]+letters[integer-27]);
            }
            if (integer>52&& integer<=78){
                list.add(letters[1]+letters[integer-53]);
            }

        }
        return list;
    }

    public List<Integer> sortFromBig() {
        return array.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
    }

    public List<Integer> sortFromSmall() {
        return array.stream().sorted().collect(Collectors.toList());
    }
}
